package com.hunliji.monitor.share.enums;

import java.util.Objects;
import java.util.stream.Stream;

/**
 * File：AlertTypeEnum.java<br> Title: <br> Description: <br>
 *
 * @author lejin
 */
public enum AlertActionTypeEnum {

    FEISHU_CHAT("feishu_chat", "飞书群通知"),
    FEISHU_USER("feishu_user", "飞书个人通知"),
    SMS("sms", "短信通知"),
    MAIL("mail", "邮件通知"),
    WORK_WECHAT("work_wechat", "企业微信通知"),
    ;

    private final String code;
    private final String msg;

    AlertActionTypeEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public String getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    public static AlertActionTypeEnum getEnumByCode(String code) {
        return Stream.of(AlertActionTypeEnum.values()).filter(o -> Objects.equals(o.getCode(), code)).findAny().orElse(null);
    }
}
